<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <!-- v-for 循环渲染 -->
    <!-- 1.循环数组 -->
    <button v-for="(item, index) in arr1" v-if="item > 2">
      第{{item}}页
    </button>
    <div v-for="(item, index) in cart">
      <p>序号：{{index+1}}</p>
      <p>商品名称： {{item.name}}</p>
      <p>商品价格： {{item.price}}</p>
    </div>
    <!-- 2.循环对象.第一个参数固定就是val，第二个参数固定就是key，第三个参数固定是index -->
    <p v-for="(val, key, index) in obj1">{{index+1}}.{{key}}: {{val}}</p>
    <hr>
    <!-- 3.循环字符串 -->
    <span v-for="item in str1">{{item}}</span>
    <!-- 4.循环整数 -->
    <button v-for="num in 5">第{{num}}页</button>
  </div>
  <script src="../vue.js"></script>
  <script>
    let vm = new Vue({
      el: '#app',
      data: {
        arr1: [1,2,3,4],
        cart: [
          {name: 'iphone 13', price: 10000},
          {name: 'mi 11', price: 6000},
          {name: 'p40', price: 7000}
        ],
        obj1: {
          name: 'Tom',
          age: 18,
          job: 'student'
        },
        str1: 'hello'
      }
    })
  </script>
</body>
</html>